﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Http.Filters;
using System.Web.Mvc;

namespace FB.Annotations
{
    public class LogErrorAttribute : HandleErrorAttribute
    {
        public override void OnException(ExceptionContext filterContext)
        {
            var logger = NLog.LogManager.GetLogger(filterContext.Controller.GetType().ToString());
            logger.Error(filterContext.Exception.Message + Environment.NewLine + filterContext.Exception.StackTrace, filterContext.Exception.ToString());

            base.OnException(filterContext);
        }

    }
}
